[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Pre-defined constant flags for FCREATE/FOPEN/FAPPEND

 Functions
  If the flags are set/used they mean the following:

   O_RD   Open file read only
   O_RW   Open file read/write
   O_WR   Open file write only

   S_DB   Deny others read/write access
   S_DN   Allow others read/write access
   S_DR   Deny others read access
   S_DW   Deny others write access

 Values
  O_RD  = 0 = 0b  = 0o = 0h
  O_RW  = 2 = 10b = 2o = 2h
  O_WR  = 1 = 1b  = 1o = 1h

  S_DB  = 3 = 11b = 3o = 3h
  S_DN  = 0 = 0b  = 0o = 0h
  S_DR  = 1 = 1b  = 1o = 1h
  S_DW  = 2 = 10b = 2o = 2h

 Remarks
  Files may be opened for read, write or combined read/write access.
  You should only use the access you need to allow other processes to
  open files at the same time in multitasking and networked environments.

  O_RD  This constant will allow your PPE to read from a file without
        writing any information out to it.

  O_RW  This constant will allow your PPE to both read from and write to a
        file without the need to close and reopen it between accesses.

  O_WR  This constant will allow your PPE to write to a file but will
        restrict read access.


  DOS 3.1 or later (which is what is required by PCBoard) allows processes
  to decide what mode of file sharing should be allowed.

  S_DB  This constant allows you to specify that other processes may
        not open the same file for either read or write access from the
        time you open the file to the time you close the file.  This is
        useful when you need exclusive access to a file for any reason
        and need to restrict other processes access to the same file.

  S_DN  This constant allows you to specify that other processes may open
        the same file for read or write access from the time you open the
        file to the time you close the file. This is useful when you don't
        need exclusive access to a file for any reason and need not
        restrict other processes.

  S_DR  This constant allows you to specify that other processes may open
        the same file, but that they may not open it for read access,
        from the time you open the file to the time you close the file.

  S_DW  This constant allows you to specify that other processes may open
        the same file, but that they may not open it for write access,
        from the time you open the file to the time you close the file.
        This is useful when you want to ensure that data will not change
        while you are reading it.

 Example

  O_RD:
  FOPEN 1,"FILE.DAT",O_RD,S_DN ' Open for read access
  FOR i = 1 TO 10
   FGET 1,s
   PRINTLN s
  NEXT
  FCLOSE 1

  O_RW:
  FOPEN 1,"FILE.DAT",O_RW,S_DN ' Open for read and write access
  FOR i = 1 TO 10
   FPUT 1,"X"
   FGET 1,s
   PRINTLN s
  NEXT
  FCLOSE 1

  O_WR:
  FOPEN 1,"FILE.DAT",O_WR,S_DN ' Open for write access
  FOR i = 1 TO 10
   FPUTLN 1,"Line ",i
  NEXT
  FCLOSE 1

  S_DB:
  FOPEN 1,"FILE.DAT",O_RD,S_DB ' Deny other processes all access
  FOR i = 1 TO 10
   FGET 1,s
   PRINTLN s
  NEXT
  FCLOSE 1 ' Close the file and allow others to open it in any mode

  S_DN:
  FOPEN 1,"FILE.DAT",O_RD,S_DN ' Do not deny other processes any access
  FOR i = 1 TO 10
   FGET 1,s
   PRINTLN s
  NEXT
  FCLOSE 1 ' Close the file and allow others to open it in any mode

  S_DR:
  FOPEN 1,"FILE.DAT",O_RD,S_DR ' Deny other processes read access
  FOR i = 1 TO 10
   FGET 1,s
   PRINTLN s
  NEXT
  FCLOSE 1 ' Close the file and allow others to open it in any mode

  S_DW:
  FOPEN 1,"FILE.DAT",O_RD,S_DW ' Deny other processes write access
  FOR i = 1 TO 10
   FGET 1,s
   PRINTLN s
  NEXT
  FCLOSE 1 ' Close the file and allow others to open it in any mode

See Also: O_RD O_RW O_WR S_DB S_DN S_DR S_DW FCREATE FOPEN FAPPEND
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson